package com.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.view.UrlBasedViewResolver;

@Controller
@RequestMapping("user")
public class UserController {

    @RequestMapping("test")
    public String test() {
        // /WEB-INF/test.jsp
        return "test";
    }


    // 强调： 在方法中使用redirect: 会忽略视图解析器
    @RequestMapping("red")
    public String test1() {
        return UrlBasedViewResolver.REDIRECT_URL_PREFIX+"/index.jsp";
    }

    @RequestMapping("red1")
    public String test2() {
        return "redirect:/user/test";
    }
}
